<?php

/**
 * LicenseeImport form.
 *
 * @package    cpfaizenay
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: LicenseeImportForm.class.php 20147 2009-07-13 11:46:57Z FabianLange $
 */
class LicenseeImportForm extends BaseForm {

    public function configure() {

        $dateWidget = new sfWidgetFormI18nDate(array(
          'format' => '%day%/%month%/%year%',
    //      'month_format' => 'short_name',
          'culture' => 'fr'
        ));
        
        $this->setWidgets(array(
          'file'                => new sfWidgetFormInputFile(),
          'datetime_points'     => new sfWidgetFormJQueryDate(array(
              'culture' => 'fr',
              'date_widget' => $dateWidget,
              'image' => '/images/admin/icons/small/calendar.png',
              'config' => '{}',
            ))
        ));
        $this->widgetSchema->setHelp('file', 'Le fichier doit être de format : [N&ordm; licence];[Nom];[Prénom];[Catégorie];[Catégorie détail];[Points]');

        $this->setValidators(array(
          'file'                => new sfValidatorFile(array('required' => true)),
          'datetime_points'     => new sfValidatorDateTime(array('required' => true))
        ));

        $this->setDefault('datetime_points', date('d-m-Y'));
        $this->widgetSchema->setNameFormat('licensee_point_import[%s]');
    }
}
